
function LoadX(){
    var pidT = document.all.pid;
    var id = pidT.value;
    
    var upcT = document.all.upc;
    var descriptionT = document.all.description;
    var brandT = document.all.brand;
    var modelT = document.all.model;
    var typeT = document.all.Saletype;
    var quantityT = document.all.quantity;
    var orderedT = document.all.ordered;
    var costT = document.all.cost;
    var priceT = document.all.price;
    
    var xmlDoc;
    xmlDoc = loadXMLDoc("Sales.xml");
    y = xmlDoc.getElementsByTagName("Sales");
    for (i = 0; i < y.length; i++) {
        x = y[i].childNodes; //a specific Sale
        //if(i<3)
        //alert( x[3].childNodes[0].nodeValue);
        if (x[1].childNodes[0].nodeValue == id) //check if matches an id
        {
            //alert( x[2].childNodes[0].nodeValue);
            upcT.value = x[15].childNodes[0].nodeValue;
            descriptionT.value = x[3].childNodes[0].nodeValue;
            brandT.value = x[5].childNodes[0].nodeValue;
            modelT.value = x[7].childNodes[0].nodeValue;
            quantityT.value = x[11].childNodes[0].nodeValue;
            orderedT.value = x[13].childNodes[0].nodeValue;
            costT.value = x[17].childNodes[0].nodeValue;
            priceT.value = x[19].childNodes[0].nodeValue;
            loadSaleTypes(x[9].childNodes[0].nodeValue);
            /*
             <Saleid>1</Saleid>
             <description>Cuenta</description>3
             <brand>Abono</brand>5
             <model>Cuenta</model>7
             <typeid>ABO</typeid>9
             <qty>0</qty>11
             <order>0</order>13
             <upc>Abono</upc>15
             <cost>0</cost>17
             <priceA>0</priceA>19
             <priceB>0</priceB>21
             <status>1</status>23
             */
            break;
        }
        else 
            document.all.status.innerHTML = 'Searching...' + i;
        
    }
    
}

function LoadXPIE(){
    var pidT = document.all.pid;
    var id = pidT.value;
    
    var upcT = document.all.upc;
    var descriptionT = document.all.description;
    var brandT = document.all.brand;
    var modelT = document.all.model;
    var typeT = document.all.type;
    var quantityT = document.all.quantity;
    var orderedT = document.all.ordered;
    var costT = document.all.cost;
    var priceT = document.all.price;
    
    //alert('vars ok:' + pidT.value);
    loadTitle2();
    return;
    var xmlDoc;
    
    xmlDoc = loadXMLDoc("Sales.xml");
    alert('load ok');
    y = xmlDoc.getElementsByTagName("Sales");
    //alert()
    for (i = 0; i < y.length; i++) {
        x = y[i].childNodes; //a specific Sale
        if (i < 3) 
            alert(x[3].childNodes[0].nodeValue);
        if (x[1].childNodes[0].nodeValue == id) //check if matches an id
        {
            //alert( x[2].childNodes[0].nodeValue);
            upcT.value = x[15].childNodes[0].nodeValue;
            descriptionT.value = x[3].childNodes[0].nodeValue;
            brandT.value = x[5].childNodes[0].nodeValue;
            modelT.value = x[7].childNodes[0].nodeValue;
            quantityT.value = x[11].childNodes[0].nodeValue;
            orderedT.value = x[13].childNodes[0].nodeValue;
            costT.value = x[17].childNodes[0].nodeValue;
            priceT.value = x[19].childNodes[0].nodeValue;
            loadSaleTypes(x[9].childNodes[0].nodeValue);
            /*
             <Saleid>1</Saleid>
             <description>Cuenta</description>3
             <brand>Abono</brand>5
             <model>Cuenta</model>7
             <typeid>ABO</typeid>9
             <qty>0</qty>11
             <order>0</order>13
             <upc>Abono</upc>15
             <cost>0</cost>17
             <priceA>0</priceA>19
             <priceB>0</priceB>21
             <status>1</status>23
             */
            break;
        }
        //else 
        //document.getElementById("status").innerHTML = 'Searching...' + i;
    
    }
    
}
